function A = gather(A)